<template>
  <el-dialog title="预览文章" :visible="dialogVisible" width="50%" @close="close" >
    <h2>{{ info.title }}</h2>
    <span>{{ info.createTime | parseTimeByString }}</span> <span> {{ info.username }} </span>
    <span> <i class="el-icon-view" /> {{ info.visits }}</span>
    <div v-html="info.articleBody" class="infobox"></div>
    <span slot="footer" class="dialog-footer">
      <el-button type="primary" @click="closedialog">关闭</el-button>
    </span>
  </el-dialog>
</template>

<script>
export default {
  props: {
    dialogVisible: {
      type: Boolean,
      default: false
    },
    info: {
      type: Object
    }
  },
  methods: {
    closedialog () {
      this.$emit('update:dialogVisible', false)
    },
    close () {
      this.closedialog()
    }
  }
}
</script>

<style scoped lang='less'>
::v-deep .infobox {
  p {
    img {
      max-width: 100%;
    }
  }
}
</style>
